<? 
$row = 5;
$col = 3;

$cat = 0;
if($_REQUEST['cat']!='') $cat=killInjection($_REQUEST['cat']);

$p=0;
if ($_REQUEST['p']!='') $p=$_REQUEST['p'];
$sql = "select * from tbl_product where status=0 and parent=".$cat." order by sort,date_added desc limit ".$row*$col*$p.",".$row*$col;
$result = @mysql_query($sql,$conn);

$total = countRecord("tbl_product","status=0 and parent=".$cat);
if($total==0){
?>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<table align="center" cellSpacing="0" cellPadding="0" width="100%" border="0">
	<tr><td height="10"></td></tr>
	<tr>
		<td align="center">
			<font color="#666666"><strong><?=$_lang=="vn"?'Products are being updated  !':'Products are being updated !'?></strong></font>
		</td>
	</tr>
	<tr><td height="10"></td></tr>
</table>
<?
}else{
?>
<table style="width:100%; background-color:#E1EEF6; margin-bottom:5px; border:1px solid #C4D8E7;;">
	<tr>
		<td style="padding:5px;">
			<?	//gioi thieu ngan phia tren
				//$sql = "select detail_short from tbl_product_category where id.tbl_product_category='".$_REQUEST['cat']."'"
				//$result = @mysql_query($sql,$conn);
				//$pro=mysql_fetch_assoc($result); $j++);
				$sql1 = "select * from tbl_product_category where id=".$cat." ";
				$result1 = @mysql_query($sql1,$conn);
				$pro1=mysql_fetch_assoc($result1); 
				
				echo '<b style="color:#FF6600;">'.$pro1['name'].': </b>';?>
				
				<br /><br /><IMG src="<?=$pro1['image']; ?>" width="60px" style="padding-left:200px;" />

			
<table cellspacing="4" cellpadding="0" width="100%" border="0" style="background:#FFFFFF; margin-top:20px; margin-bottom:20px;">
<?
for($i=0; $i<$row; $i++){
?>
		  	
<?
	for($j=0; $j<$col&&$pro=mysql_fetch_assoc($result); $j++){				
			if($pro['image_large']!=''){
				$image=$pro['image_large'];
				}
				else{
				$image=$pro['image'];
				}
				//$size = getimagesize($image);
				//$height = $size[1]+50;
				//$width = $size[0]+20;		?>
				
		
				<tr>
				  <td height="40" colspan="2" align="center" valign="middle" bgcolor="#F5F7FB" >
					  <!--a href="./?frame=product_detail&id=<?=$pro['id']?>" class="text_pro"-->
					 	 <?=$pro['name']?> 
					  <!--/a-->
				  </td>

				  <td height="25" colspan="2" align="center"><?=_PRICE?>: <span class="red">
				  	<strong>
						<? if ($pro['price']==0){
							echo "Contact Us";}
							else{
							//echo number_format($pro['price'],0,',','.');
							echo $pro['price'];
							echo '<span class="gbp">&nbsp;GBP</span></strong></span>';
							}
						?>
					</strong></span> </td>
			
				
				  <td align="center" height="30" style="padding-top:5px" valign="bottom" colspan="2"><a href="./?frame=cart&p=<?=$pro['id']?>" class="buynow">
				  	  <img src="images/cart.jpg" width="20" height="17" vspace="2" border="0" align="absmiddle" />&nbsp;&nbsp;Buy Now  &nbsp;&nbsp;</a>
					</td>					 
				</tr>		
      <?
}
while($j<$col){
	echo "";
	$j=$j+1;
}
}?>
</table>
			
				<? echo '<span style="color:#1C7903;">'.$pro1['detail_short'].' </span>';
			?>
		</td>
	</tr>
</table>
<table style="width:100%; background-color:#E1EEF6; margin-top:5px; border:1px solid #C4D8E7;;">
	<tr>
		<td style="padding:5px;">
			<?	//gioi thieu chi tiet phia duoi
				//$sql = "select detail_short from tbl_product_category where id.tbl_product_category='".$_REQUEST['cat']."'"
				//$result = @mysql_query($sql,$conn);
				//$pro=mysql_fetch_assoc($result); $j++);
				$sql1 = "select * from tbl_product_category where id=".$cat." ";
				$result1 = @mysql_query($sql1,$conn);
				$pro1=mysql_fetch_assoc($result1); 
				echo '<span style="color:#1C7903;">'.$pro1['detail'].': </span>';
			?>
		</td>
	</tr>
</table>

<table width="98%" border="0">
 <tr><td class="line">&nbsp;</td></tr>
</table>
<br />
<table align="center" cellSpacing=0 cellPadding=0 width="98%" border=0>
<?
$newsPage       = $_lang=="vn" ? "Products" : "Products";
$pagePage       = $_lang=="vn" ? "Page" : "Page";
$titleFirst     = $_lang=="vn" ? "First" : "First";
$titlePrevious  = $_lang=="vn" ? "Previous" : "Previous";
$titleNext      = $_lang=="vn" ? "Next" : "Next";
$titleLast      = $_lang=="vn" ? "Last" : "Last";

$pages = countPages($total,$row*$col);
echo '<tr><td colspan="2" align="center"></td></tr>';
echo '<tr><td class="smallfont" align="left"><b>'.$total.'</b> '.$newsPage.'</td>';
echo '<td class="smallfont" align="right">'.$pagePage.' : ';
$param="";
if ($p>1) echo '<a class="aLink3" title="'.$titleFirst.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&p=0">[&lt;&lt;]</a> ';
if ($p>0) echo '<a class="aLink3" title="'.$titlePrevious.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&p='.($p-1).'">[&lt;]</a> ';
$from=($p-10>0?$p-10:0);
$to=($p+10<$pages?$p+10:$pages);
for ($i=$from;$i<$to;$i++){
	if ($i!=$p) echo '<a class="aLink3" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&p='.$i.'">'.($i+1).' </a>';
	else echo '<span class="current"> '.($i+1).'</span>';
}
if ($p<$i-1) echo '<a class="aLink3" title="'.$titleNext.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&p='.($p+1).'">[&gt;]</a> ';
if ($p<$pages-1) echo '<a class="aLink3" title="'.$titleLast.'" href="./?frame='.$_REQUEST['frame'].'&cat='.$_REQUEST['cat'].'&p='.($pages-1).'">[&gt;&gt;]</a>'; 
echo '</td></tr>';
?>
</table><br />
 
<? }?>